package com.task.core.mapper;


import com.task.core.domain.DataPreAvailableInfo;
import com.task.core.domain.MissionInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface DataPreAvailableMapper {

    void initPreAvailable(@Param("list") List<DataPreAvailableInfo> list);

    DataPreAvailableInfo getCanUseChildTableSuffixRandomBySourceCodes(@Param("sourceCodeList") List<String> sourceCodeList,
                                                                      @Param("missionCode") String missionCode,
                                                                      @Param("affiliateCode") String affiliateCode,
                                                                      @Param("advertiserCode")  String advertiserCode,
                                                                      @Param("missionFlag") String missionFlag,
                                                                      @Param("affiliateString") String affiliateString,
                                                                      @Param("advertiserFlag")String advertiserFlag);

//    void updataAvailableDataBatchByIsInitAndSouceCode(@Param("list")List<DataPreAvailableInfo> list);

    void updateAvailableTableCount(@Param("dataPreAvailableInfo") DataPreAvailableInfo dataPreAvailableInfo,@Param("missionFlag") String missionFlag,@Param("affiliateFlag") String affiliateFlag,@Param("advertiserFlag") String advertiserFlag);

    List<DataPreAvailableInfo> selectPreAvailableBySourceCode(@Param("dataSourceCode")String dataSourceCode);

    void updatePreAvailable(DataPreAvailableInfo dataPreAvailableInfo);

    DataPreAvailableInfo getCanUseSendRefere(@Param("sourceCodeList")List<String> sourceCodeList);

    void updatePreAvailableDataIncrease(@Param("sourceCode")String sourceCode,
                                        @Param("duplicateCode")String duplicateCode,
                                        @Param("missionFlag") String missionFlag,
                                        @Param("affiliateFlag") String affiliateFlag,
                                        @Param("advertiserFlag") String advertiserFlag);

    DataPreAvailableInfo selectPreAvailableBySourceCodeAndDuplicateCondition( @Param("dataSourceCode")String dataSourceCode,
                                                                              @Param("missionCode")String missionCode,
                                                                              @Param("affiliateCode")String affiliateCode,
                                                                              @Param("advertiserCode")String advertiserCode);

    void insertPreUseInfo(DataPreAvailableInfo preAvailableInfo);

    DataPreAvailableInfo getUseDataCountByFilterAndSourceCode( @Param("missionByCode")MissionInfo missionByCode, @Param("sourceCode") String sourceCode);

    List<DataPreAvailableInfo>  getPreAvailableBySourceCode(String datasourceCode);

    void deletePreAvailableData(@Param("datasourceCode")String datasourceCode);

    void updatePreAvailableByCode(DataPreAvailableInfo dataPreAvailableInfo);
}
